package com.zuorenke.rabbit;

import com.zuorenke.serialize.DefaultMQMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Z.R.K
 * @description
 * @create 2019-05-20 16:12:20
 **/
@Configuration
public class RabbitMQSenderConfig {
	@Value("${rabbit.exchanges.file-error}")
	private String fileErrorE;
	@Value("${rabbit.queues.file-error}")
	private String fileErrorQ;
	@Value("${rabbit.exchanges.bind-lesson}")
	private String bindLessonE;
	@Value("${rabbit.queues.bind-lesson}")
	private String bindLessonQ;
	@Value("${rabbit.exchanges.load-course-ware}")
	private String loadCourseWareE;
	@Value("${rabbit.queues.load-course-ware}")
	private String loadCourseWareQ;
	
	@Bean
	public MessageConverter messageConverter() {
		return new DefaultMQMessageConverter();
	}
	
	@Bean
	public RabbitMQSender fileErrorSender() {
		return new RabbitMQSender(fileErrorE, fileErrorQ);
	}
	
	@Bean
	public RabbitMQSender bindLessonSender() {
		return new RabbitMQSender(bindLessonE, bindLessonQ);
	}
	
	@Bean
	public RabbitMQSender loadCourseWareSender() {
		return new RabbitMQSender(loadCourseWareE, loadCourseWareQ);
	}
	
}
